<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.ajax 2.定时器

        // ajax
        console.log('start');
        $.get('./data1.json', function (data1) {
            console.log(data1);
        })
        console.log('end');
        // 打印顺序为先打印start然后打印end，最后等网络请求结束才打印data1中的内容

        // 图片加载
        console.log('start');
        let img = document.createElement('img');
        img.onload = function () {
            console.log('loaded');
        }
        img.src = '/xxx.png'
        console.log('end');
// 打印顺序为先打印start然后打印end，然后等待img.src什么时候加载完，才打印loaded

//2.setTimeout 和setInterval
    </script>
</body>

</html>